from django.contrib import admin
from .models import CredentialCategory, Credential, CredentialImportLog

@admin.register(CredentialCategory)
class CredentialCategoryAdmin(admin.ModelAdmin):
    list_display = ['name', 'created_at']
    search_fields = ['name']

@admin.register(Credential)
class CredentialAdmin(admin.ModelAdmin):
    list_display = ['location', 'device_name', 'username', 'status', 'created_at']
    list_filter = ['location', 'status', 'created_at']
    search_fields = ['location', 'device_name', 'username']
    readonly_fields = ['created_at', 'updated_at']

@admin.register(CredentialImportLog)
class CredentialImportLogAdmin(admin.ModelAdmin):
    list_display = ['file_name', 'total_count', 'success_count', 'import_by', 'import_time']
    list_filter = ['import_time', 'import_by']
    readonly_fields = ['import_time']